import request from '@/helper/request'

/**
 * @description 查询飞手数据
 * @param page 页码
 * @param nickName 昵称
 * @param username 用户名
 * @param enabled 用户状态
 * @return {AxiosPromise}
 */
export function getAppUserInfo({page, nickName, username, enabled, userCode, userId, gender, phone, size}) {
	return request({
		url: '/api/appUser',
		method: 'get',
		params: {
			page,
			size,
			nickName,
			username,
			enabled,
			userCode,
			userId,
			gender,
			phone,
		}
	})
}

/**
 * @description 新增飞手
 * @param email
 * @param gender
 * @param enabled
 * @param nickName
 * @param username
 * @param phone
 * @param state
 * @return {AxiosPromise}
 */
export function addFlyUser({email, gender, enabled, nickName, username, phone, userCode, userId}) {
	return request({
		url: '/api/appUser',
		method: 'post',
		data: {
			email,
			gender,
			enabled,
			nickName,
			username,
			phone,
			userCode,
			userId
		}
	})
}

/**
 * @description 编辑飞手信息
 * @param email
 * @param gender
 * @param enabled
 * @param nickName
 * @param username
 * @param phone
 * @param userId
 * @return {AxiosPromise}
 */
export function editFlyUser({email, gender, enabled, nickName, username, phone, userId, userCode}) {
	return request({
		url: '/api/appUser',
		method: 'put',
		data: {
			email,
			gender,
			enabled,
			nickName,
			username,
			phone,
			userId,
			userCode

		}
	})
}

/**
 * @description 查询飞手数据详情
 * @return {AxiosPromise}
 */
export function getAppUserDetailInfo({userId}) {
	return request({
		url: '/api/appUser/getOne',
		method: 'get',
		params: {
			userId
		}
	})
}

/**
 * @description 删除用户
 */
export function deleteUserByUserId({userId}) {
	return request({
		url: '/api/appUser',
		method: 'delete',
		data: [userId]
	})
}
